package com.thkj.util;

public class RJ {

	public final static RJ SUCCESS = RJ.success(null);
	// 是否处理成功
	String code = null;
	// 数据
	Object data;
	// 错误信息
	String message;

	/**
	 * 成功，输入需要返回的结果
	 * 
	 * @param data
	 *            输出的结果
	 * @return R
	 */
	public static RJ success(Object data) {
		RJ rs = new RJ();
		rs.code = "200";
		rs.data = data;
		rs.message = "成功";
		return rs;
	}
	
	public static RJ success(Object data,String msg) {
		RJ rs = new RJ();
		rs.code = "200";
		rs.data = data;
		rs.message = msg;
		return rs;
	}

	public static RJ failure(String code,String msg) {
		RJ rs = new RJ();
		rs.code = code;
		rs.data = null;
		rs.message = msg;
		return rs;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public Object getData() {
		return data;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}
